package main

import (
	"context"
	"fmt"

	"gitee.com/zawei/yggdrasil/example/api"
	"gitee.com/zawei/yggdrasil/pkg/registry/nacos"
	_ "gitee.com/zawei/yggdrasil/pkg/registry/nacos"
	"gitee.com/zawei/yggdrasil/pkg/transport/client/grpc"
	pb "google.golang.org/grpc/examples/helloworld/helloworld"
)

func main() {
	client := pb.NewGreeterClient(grpc.NewClient("helloworld.Greeter", nacos.NewRegistry()))
	_, err := client.SayHello(context.TODO(), &pb.HelloRequest{Name: "hello"})
	fmt.Println(api.IsTTD(err), api.IsTTDd(err))
	res, err := client.SayHello(context.TODO(), &pb.HelloRequest{Name: "ok"})
	fmt.Println(err, api.IsTTD(err), api.IsTTDd(err))
	if err != nil {
		return
	}
	fmt.Println("result: ", res.Message)
	select {}
}
